package com.guanyong.webapi.controllers.api;

import com.guanyong.services.BannerListService;
import com.guanyong.utils.Comm.ResultCode;
import com.guanyong.utils.Comm.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * Created by Administrator on 2017/10/20 0020.
 */
@RestController
@RequestMapping("/api/banner/")
public class BannerApi {

    @Autowired
    BannerListService bannerListService;


    //修改成已显示的了。
    @RequestMapping(value = "getByBannerFilmList", method = RequestMethod.GET)
    public ResultObject<HashMap<String,Object>> GetByBannerFilmList(@RequestParam int limit){
        ResultObject<HashMap<String,Object>> resultObject=new ResultObject<HashMap<String,
                Object>>();
        HashMap<String ,Object> hashMap = new HashMap<String ,Object>();
        if (limit>0 && limit<10){
            hashMap=bannerListService.GetByBannerFilmList(limit);
        }else{
            resultObject.setCode(ResultCode.ParamsError);
        }
        resultObject.setResult(hashMap);
        return  resultObject;

    }
}
